/**
 * Description:
 *
 * @author      Eden
 * @datetime    2016/11/25 09:31
 * @copyright   Beijing CmsTop Technology Co.,Ltd.
 */

(function () {

    "use strict";

    var api = {
        getCarCountUrl: '/car/counter'
    };

    sm.controller('car-controller', ['$scope', '$http', function ($scope, $http) {

        $scope.carCounter = 0;
        $http.get(api.getCarCountUrl).success(function (res) {
            if (res.state) {
                $scope.carCounter = res.data.total;
            }
        });

        $scope.$on('carCounter', function(e, newValue) {
            $scope.carCounter = newValue;
        });

    }]);


}());